


// const HtmlWebpackPlugin = require('html-webpack-plugin');
//
// const CleanWebpackPlugin = require('clean-webpack-plugin');

const webpack = require('webpack');
const path = require('path');

module.exports = {
    entry:[
        './main.js',
        'whatwg-fetch'
    ],
    output: {
        filename: 'bundle.js',
        //path: path.join(__dirname, 'dist')
         path:__dirname
    },
    devtool: 'inline-source-map',
    devServer: {
        hot: true,
        historyApiFallback: true,
        compress: true,
        port: 9000
    },
    resolve: {
        modules: ['node_modules', 'src']
    },
    module: {
        rules: [
            {
                test: /\.(js|jsx)$/,
                exclude:/node_modules/,
                loader:'babel-loader',
                query:{
                    presets:['es2015','react']
                }
            },

            {
                test: /\.css$/,
                use:['style-loader','css-loader?modules&localIdentName=[name]__[local]-[hash:base64:5]']
                // use: ['style-loader', 'css-loader'],
            },
            {
                test: /\.scss$/,
                use:['style-loader','css-loader']
            },
            {
                test: /\.(png|svg|jpg|gif)$/,
                use: [
                    'file-loader'
                ]
            },
            {
                test: /\.(woff|woff2|eot|ttf|otf)$/,
                use: [
                    'file-loader'
                ]
            }
        ]
    },

    plugins: [

        // new CleanWebpackPlugin(['dist']),
        //
        // new HtmlWebpackPlugin({
        //
        //     title: 'Library Management'
        //
        // }),

        new webpack.HotModuleReplacementPlugin()
    ]
};

